package ltd.dujiabao.eduvod.utils;

import com.aliyun.oss.ClientException;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest;
import com.aliyuncs.vod.model.v20170321.DeleteVideoResponse;

/**
 * @author : DuJiabao
 * @Project : online-course-project
 * @Time : 2021/4/23 10:20
 * @Desc :
 */
public class AliyunVodSDKUtils {
  public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret, String regionId) throws ClientException {
    DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
    return new DefaultAcsClient(profile);
  }

  /**
   *
   * @param client
   * @param ids 支持传入多个视频ID，多个用逗号分隔
   * @return
   * @throws Exception
   */
  public static DeleteVideoResponse deleteVideo(DefaultAcsClient client, String ids) throws Exception {
    DeleteVideoRequest request = new DeleteVideoRequest();
    request.setVideoIds(ids);
    return client.getAcsResponse(request);
  }

}
